package com.zeno.soil.rbac.repository;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.zeno.soil.rbac.model.bo.SubjectRoleBO;
import com.zeno.soil.rbac.repository.po.SubjectRole;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;

/**
 *
 *
 * @author zeno
 */
@Mapper
public interface SubjectRoleMapper extends BaseMapper<SubjectRole> {

  /**
   *
   * @return
   */
  @Select("select * from (select sr.subject_id subjectId,sr.subject_type subjectType,sr.role_code roleCode,r.name roleName from role r "
          + "inner join subject_role sr on r.code=sr.role_code)  sb")
  List<SubjectRoleBO> findSubjectRoles();
}